#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
	int n, i;
	int stone[200];
	bool suc;
	while (1)
	{
		scanf("%d", &n);		
		if (n==0) break;
		for (i=1; i<=n; ++i)
			scanf("%d", &stone[i]);
		sort(stone+1, stone+n+1);
		if (n%2==1) printf("1\n");
		else
		{
			suc = false;
			for (i=1; i<=n; i+=2)
			{
				if (stone[i]!=stone[i+1]) 
				{
					suc = true;
					break;
				}
			}
			if (suc) printf("1\n");
			else printf("0\n");
		}
	}

	return 0;
}